TABLE.ERASE Function

Syntax

V Erase(C Filename,L safety)

Arguments

Filename

The name of the table or set, including either the .dbf or .SET extension.

safety

Logical

.T. = Erase table.
.F. = Do not erase table.

Description

Delete the table if safety is TRUE.

Discussion

The TABLE.ERASE() method removes the specified table or set file ( Filename ), its production index file, and its data dictionary from disk. as a safeguard, you must set the Confirmation_Flag parameter to TRUE (.T.) to perform the Erase operation. This method is the preferred way for erasing a table file and all its support files. Erasing a table file with the FILE.REMOVE() method can also be done; however, you will need to clean up any remaining support files yourself. To remove the table from the Control Panel, use FILE_DROP_FROM_DB().

This script prompts the user for a table to erase, erases the table, and then checks to be sure the table has actually been erased properly.

filename = ui_get_file("Erase:","Tables (*.DBF)","","X")
if filename = "" then
    end
end if
table.erase(filename, .T.)
result = file.exists(filename)
if result = .F. then
    ui_msg_box("Erase", filename + " erased.")
else
    ui_msg_box("Erase:Error", "Erase failed.")
end if

See Also